A command-line tool for automatically generating API documentation in Markdown format from Risor source files. This tool extracts documentation comments, method signatures, and other metadata to create comprehensive API documentation.
- Extracts documentation from Risor source code
- Supports both class methods and global functions
- Parses description, parameter, and return value documentation
- Generates formatted Markdown output
- Automatic example code generation
- Ensure you have Risor installed on your system
- Clone this repository
- Build the binary with RSX
rsx build
./risor-docgen -i <input_file> -o <output_file>
-i, --input
- Input Risor file (default: "tlz.risor")-o, --output
- Output Markdown file (default: "api.md")
The generator looks for specific comment patterns in your Risor code:
// Description of the function
// This can span multiple lines
//
// Parameters:
// - param1: Description of first parameter
// - param2: Description of second parameter
//
// Returns: Description of what is returned
The tool looks for special annotation comments:
@object.class
- Marks a class declaration@object.method
- Marks a class method@global.function
- Marks a global function
Input Risor file:
// @object.class
Calculator := {
// Adds two numbers
//
// Parameters:
// - a: First number
// - b: Second number
//
// Returns: Sum of a and b
// @object.method
add = func(a, b) {
return a + b
}
}
Output Markdown:
# Calculator class
## add
Adds two numbers
### Parameters
- a: First number
- b: Second number
### Returns
Sum of a and b
### Example
```go
// Example usage of add
Calculator.add(a, b)
```
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.